﻿<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>table模块快速使用</title>
  <link rel="stylesheet" href="/layui/css/layui.css" media="all">
</head>
<body>
<table id="demo" lay-filter="test"></table>
 
<script src="/layui/layui.js"></script>
<script>
    function getCname(obj) {
        //alert("选课成功");
        parent.layer.msg('选课成功');
    }
</script>
<script type="text/html" id="barDemo">
  <button class="layui-btn layui-btn-normal layui-btn-xs" onclick="getCname(this )">选择该课程</button>
</script>
<script>
layui.use(['table','layer'], function(){
    var table = layui.table
        , $ = layui.$
  //第一个实例
  table.render({
    elem: '#demo'
      , height: 520
      , url: '/Lesson.aspx' //数据接口
    ,page: true //开启分页
    ,cols: [[ //表头
      {field: 'cname', title: '课程名', width:100, fixed: 'left'}
      ,{field: 'classhour', title: '课时', width:100}
      ,{field: 'credit', title: '学分', sort: true, width:100}
      ,{field: 'tname', title: '授课老师', width:150}
      ,{field: 'type', title: '类别',  width:100}
      ,{field: 'place', title: '地点', width:200}
      ,{field: 'time', title: '时间', width:300}
      , { field: 'right', title: '操作',toolbar: '#barDemo'}

    ]]
    });
    
});
</script>
</body>
</html>